package com.zw.yzk.kabu.data.repository;


import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.ClassifyShopEntity;
import com.zw.yzk.kabu.data.network.service.ClassifyShopService;
import com.zw.yzk.kabu.data.network.task.ClassifyShopTask;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2017/1/4.
 */

public class ClassifyShopRepository extends CommonRepository {


    @Inject
    public ClassifyShopRepository() {
    }

    @Override
    protected Observable connectServer(Task task) {
        ClassifyShopService service = ServiceGenerator.createService(ClassifyShopService.class);
        ClassifyShopTask shopTask = (ClassifyShopTask) task;

        //加载网络数据
        return service.getExhibitionList(shopTask.classifyId, shopTask.start, shopTask.size);
    }

    @Override
    protected Func1<ClassifyShopEntity, Observable> getServerData() {
        return new Func1<ClassifyShopEntity, Observable>() {
            @Override
            public Observable call(ClassifyShopEntity entity) {
                return Observable.just(entity);
            }
        };
    }


}
